using System;
using NUnit.Framework;

namespace CodePlex.DnD4eCampaignManager.CampaignManagerTests.DnD4eTests
{
    public static class TestHelpers
    {
        public static void TestEquatabilityExcludingOperators<T>(T primaryDomainObject, T duplicateDomainObject, T differentDomainObject) where T : class, IEquatable<T>
        {
            const object nullObject = null;
            T nullT = null;
            object primaryDomainObjectAsAnObject = primaryDomainObject;
            object duplicateDomainObjectAsAnObject = duplicateDomainObject;

            Assert.IsTrue(primaryDomainObject.Equals(primaryDomainObject));
            Assert.IsTrue(primaryDomainObject.Equals(primaryDomainObjectAsAnObject));
            Assert.IsTrue(primaryDomainObject.Equals(duplicateDomainObjectAsAnObject));
            Assert.IsTrue(primaryDomainObject.Equals(duplicateDomainObject));
            Assert.IsFalse(primaryDomainObject.Equals(differentDomainObject));
            Assert.IsFalse(primaryDomainObject.Equals(nullObject));
            Assert.IsFalse(primaryDomainObject.Equals(nullT));
            Assert.IsFalse(primaryDomainObject.Equals(new object()));
            Assert.AreNotEqual(null, primaryDomainObject);
            Assert.AreEqual(primaryDomainObject.GetHashCode(), primaryDomainObject.GetHashCode());
        }

    }
}